package org.dwell.dubbox.provider;

import com.alibaba.dubbo.rpc.RpcContext;
import org.dwell.dubbox.api.DemoSayHelloService;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Jange on 2016/3/23.
 */
public class DemoSayHelloServiceImpl implements DemoSayHelloService {

    @Override
    public String sayHello(String name) {
        System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
        return "Hello " + name + ", response form provider: " + RpcContext.getContext().getLocalAddress();
    }

}
